cmake_minimum_required(VERSION 3.20)

project(CMake_Control_Library)
message("--System Name:${CMAKE_SYSTEM_NAME}")
message("--CMake Generaotr:${CMAKE_GENERATOR}")

# 控制库的生成 Static or Shared
option(BUILD_SHARED_LIBS "Using shared library?" ON)

# 静态库输出目录 .a .lib
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/archive)
# 共享库输出目录 .so
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
# 可执行程序输出目录 .exe .dll
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)

message("CMAKE_ARCHIVE_OUTPUT_DIRECTORY = ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
message("CMAKE_LIBRARY_OUTPUT_DIRECTORY = ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message("CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")

# 添加目标
add_subdirectory(AMath)
add_executable(Coco main.cpp)
target_link_libraries(Coco PRIVATE AMath)
